package com.bjsdzk.collector.mapper;

import java.util.List;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.ResultType;
import org.apache.ibatis.annotations.Select;

import com.bjsdzk.collector.entity.model.Command;
import org.springframework.stereotype.Component;


@Mapper
@Component
public interface CommandMapper {
	@Select("SELECT d.* FROM command d ")
	@ResultType(Command.class)
	List<Command> findAll();
	//&gt; &lt;
	@Select("SELECT * FROM command where address >= #{startAddress} and  address <= #{endAddress}  and deviceType=#{deviceType}  ORDER BY deviceType,address")
	@ResultType(Command.class)
	List<Command> findAllByAddressAll(String startAddress,String endAddress,String deviceType);
	
	@Select("SELECT * FROM command where sendId >= #{startAddress} and  sendId <= #{endAddress}  and deviceType=#{deviceType}  ORDER BY deviceType,address")
	@ResultType(Command.class)
	List<Command> findAllBySendIdAll(String startAddress,String endAddress,String deviceType);
	
	@Select("SELECT * FROM command where address=#{startAddress} and deviceType=#{deviceType}  ORDER BY deviceType,address")
	@ResultType(Command.class)
	List<Command> findAllByAddress(String startAddress,String deviceType);
}